###类装饰器
class MyDecorator():
    def __init__(self, func):
        self.func = func

    def __call__(self, *args, **kwargs):
        print("这是装饰后具有的新输出")
        #调用hello()函数
        return self.func(*args, **kwargs)

# def my_decorator(func):
#     def wrapper():
#         print("这是装饰后具有的新输出")
#         func()
#     return wrapper

@MyDecorator
def hello():
    print("你好，装饰器")

if __name__ == '__main__':
    hello()


